﻿using System.Collections;
using System.Collections.Generic;

using Entitas;

using UnityEngine;


namespace Internal
{
    /// <summary>
    /// 监测鼠标的响应系统
    /// </summary>
    public class MouseSystem : IExecuteSystem, IInitializeSystem
    {
        //private InputEntity inputEntity;

        public InputContext context;

        public MouseSystem(Contexts contexts)
        {
            context = contexts.input;
        }


        public void Initialize()
        {
            //context = context.internalMouseEventEntity;
        }

        public void Execute()
        {
            if (Input.GetMouseButtonDown(0))
            {
                //更新数据
                context.ReplaceInternalMouseEvent(MouseEvent.LEFT,MouseClickEvent.DOWN);
            }
            if (Input.GetMouseButtonDown(1))
            {
                //更新数据
                context.ReplaceInternalMouseEvent(MouseEvent.RIGHT, MouseClickEvent.DOWN);
            }
            if (Input.GetMouseButtonDown(2))
            {
                //更新数据
                context.ReplaceInternalMouseEvent(MouseEvent.MIDDLE, MouseClickEvent.DOWN);
            }
            
        }


    }
}

